package com.ruoyi.jeeplus.modules.screen.frontdesk.screen_charge.controller;

import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_PV.mapper.FrontdeskScreenPVMapper;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_charge.domain.Frontdesk_screen_chargeNew;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_charge.mapper.Frontdesk_screen_chargeMapper;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_charge.service.impl.Frontdesk_screen_chargeServiceImpl;
import com.ruoyi.jeeplus.modules.screen.screen_charge.domain.screen_charge;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 刘奥旸
 * @version 1.0
 */
@RestController
public class Frontdesk_screen_chargeController {

    @Autowired
    Frontdesk_screen_chargeMapper frontdeskScreenChargeMapper;
    @Autowired
    Frontdesk_screen_chargeServiceImpl frontdeskScreenChargeService;
    @Autowired
    FrontdeskScreenPVMapper frontdeskScreenPVMapper;


    @GetMapping(value = "/lay/charge")
    public  Map<String, Object> a32(@RequestParam String two_four,@RequestParam int date,@RequestParam String id){
        // 正则表达式判断 id 是否是数字
        if (id.matches("^[0-9]+$")) {
            // 如果 id 是数字，执行数字相关的逻辑
            Map<String, Object> stringObjectMap = frontdeskScreenChargeService.a32(two_four, date, id);
            return stringObjectMap;
        }else {
            //这是省的逻辑，文字查出来
            Integer region_id = frontdeskScreenPVMapper.getIdByName(id);
            String region = region_id + "";
            return frontdeskScreenChargeService.a32(two_four, date, region);
        }
    }
    //这个是共用测试模块
    @GetMapping(value = "/lay/exere")
    public  HashMap<String, Object> a322(@RequestParam String two_four,@RequestParam int date,@RequestParam int id){
        Map<String, Object> stringObjectMap = frontdeskScreenChargeService.status_time(two_four, date, id);
        HashMap<String, Object> bigDecimals = frontdeskScreenChargeService.month_day(two_four, date, id);
        return bigDecimals;
    }
}
